<!DOCTYPE html>
<html>
<#include "../head.html">
    <body>
    <div class="mc">
        <div class="mc-l">
            <!--左侧导航---{-->
            <div id="navPanelContainer">
                <div class="system-logo cd"></div>
                <!--管理员信息---{-->
                <#include "../adminInfo.html">
                    <!--管理员信息---}-->
                    <div class="nav-wrap">
                        <#include "leftFromYyToCf.html">
                    </div>
            </div>
            <!--左侧导航---}-->
        </div>
        <div class="mc-m">
            <div class="navToggle"></div>
        </div>
        <div class="mc-r">
            <!--顶部导航---{-->
            <#include "../topNav.html">
                <!--顶部导航---}-->
                <#assign fd="FINANCE_DIRECTOR">
                    <!--面包屑导航---{-->
                    <#assign moduleName="客户跟踪记录">
                        <#include "banner.html">
                            <!--面包屑导航---}-->

                            <!--工具栏--{-->
                            <div id="toolbar" class="clearfix toolbor-module" style="text-align: right;padding-top: 15px;">

                                <#if fd  == auth_user.userType.code>
                                    <div class="search"  style="float:left;margin-top:0">
                                        <a id="batchdel" href="javascript:void(0);" class="input-button" style="line-height:24px;margin-left:20px">批量删除</a>
                                    </div>
                                </#if>

                                <span class="formTit">客户姓名 ：</span>
                                <input type="text" name="searchName" id="searchName" class="search-value">

                                <div class="toolbor-module search" style="margin-top:0">
                                    <!-- <a href="addTrackRecord.html" class="input-button">+新增跟踪记录</a> -->
                                </div>
                                开始日期：<input id="startDate" type="text" name="startDate" style="width:125px;padding:0 10px;height:18px;line-height:18px;" onclick="change_picktime('yyyy-MM-dd')" readonly/>
                                结束日期：<input id="endDate" type="text" name="endDate" style="width:125px;padding:0 10px;height:18px;line-height:18px;" onclick="change_picktime('yyyy-MM-dd')" readonly/>

                                <#if fd  == auth_user.userType.code>
                                    <span class="formTit">理财经理：</span>
                                    <input type="text" name="fmName" id="fmName"  class="search-value">
                                </#if>
                                <span class="formTit">主题：</span>
                                <input  type="text" name="subject" id="subject" class="search-value">
                                <input type="button" value="搜索" style="float:none"  class="input-button" onclick="sousuo();">
                            </div>


                            <!--工具栏--}-->

                            <div id="main" class="clearfix">
                                <form id="batchForm" action="/admin/crm/batchDelTrackRecord.html" method="post">
                                    <table class="data-list">
                                        <tr class="header">
                                            <#if fd  == auth_user.userType.code> <td><input type="checkbox"  name="chk_all" id="chk_all"/></td></#if>
                                            <td>ID</td>
                                            <td>姓名</td>
                                            <td>电话</td>
                                            <td>跟进日期</td>
                                            <td>修改日期</td>
                                            <td>主题</td>
                                            <td>内容</td>
                                            <td>理财经理</td>
                                            <td>操作</td>
                                        </tr>
                                        <#list list as item>
                                            <tr class="s">
                                                <#if fd  == auth_user.userType.code> <td><input type="checkbox" value="${item.id?c}"  name="trIds"/></td></#if>
                                                <td>${item.id!0}</td>
                                                <td>${item.custName!''}</td>
                                                <td>
                                                    <#if item.customer.user?? && item.customer.user.phone??>
                                                        ${item.customer.user.phone}
                                                    </#if>
                                                </td>
                                                <td>${(item.createDate)?string("yyyy-MM-dd HH:mm:ss")}</td>
                                                <td>${(item.modifyDate)?string("yyyy-MM-dd HH:mm:ss")}</td>
                                                <td>${item.subject!''}</td>
                                                <td>${item.content!''}</td>
                                                <td>${item.systemUser.realname!''}</td>
                                                <td>
                                                    <a class="un" href="/admin/crm/addTrackRecord.html?custId=${(item.customer.id!0)?c}&custName=${item.custName!''}&page=${page.currentPage}&searchName=${searchName}">跟踪</a>
                                                    <a class="un" href="/admin/crm/modifyTrackRecord.html?id=${(item.id!0)?c}&page=${page.currentPage}&searchName=${searchName}">修改</a>
                                                    <#if fd  == auth_user.userType.code>
                                                        <a class="un" href="/admin/crm/delTrackRecord.html?id=${(item.id!0)?c}&page=${page.currentPage}&searchName=${searchName}">删除</a>
                                                    </#if>
                                                    <a class="un" href="/admin/crm/showUserTrackRecord.html?custId=${(item.customer.id!0)?c}">查看跟踪记录</a>
                                                </td>
                                            </tr>
                                        </#list>
                                    </table>
                                </form>


                                <!--底部工具栏--{-->
                                <div id="bottomToolbar" class="clearfix">
                                    <div class="other-tool">
                                        <dl class="refresh-data">
                                            <dt class="refresh-data-icon"></dt>
                                            <dd><a href="javascript:void(0);" class="refresh-page">刷新数据</a></dd>
                                        </dl>
                                    </div>
                                    <!--翻页系统--{-->
                                    <div class="container s_formPage">
                                        <#import "../../common/page.html" as pager>
                                            <@pager.pagination page=page url="${pageUrl}" map=param style="style1" />
                                    </div>
                                    <!--翻页系统--}-->
                                </div>
                                <!--底部工具栏--}-->


                                <script>
                                    var url = 'queryTrackRecord.html?search=true';

                                    function sousuo(){
                                        var sou = "";
                                        var ofp = $("#searchName").val();
                                        var fmn = $("#fmName").val();
                                        var subject = $("#subject").val();
                                        var startDate = $("#startDate").val();
                                        var endDate = $("#endDate").val();
                                        if((ofp!=null&&ofp!=""&&ofp!="undefined"&&ofp!="请输入客户姓名关键字")){
                                            sou += "&searchName="+ofp;
                                        }
                                        if((fmn!=null&&fmn!=""&&fmn!="undefined" && fmn!="请输入理财经理关键字")){
                                            sou += "&fmName="+fmn;
                                        }
                                        if(startDate!=null && startDate !=""){
                                            sou+="&startDate="+startDate;
                                        }
                                        if(endDate!=null && endDate !=""){
                                            sou+="&endDate="+endDate;
                                        }
                                        if(subject!=null && subject !=""&& subject!="请输入主题关键字"){
                                            sou+="&subject="+subject;
                                        }
                                        if (sou!=""){
                                            location.href=url+sou;
                                        }
                                    }
                                    $("#searchName")[0].defaultValue=getQueryString("searchName","请输入客户姓名关键字");
                                    $("#fmName")[0].defaultValue=getQueryString("fmName","请输入理财经理关键字");
                                    $("#subject")[0].defaultValue=getQueryString("subject","请输入主题关键字");
                                    function getQueryString(name,tip){
                                        var reg=new  RegExp("(^|&)"+name+"=([^&]*)(&|$)");
                                        var r =window.location.search.substr(1).match(reg);
                                        if(r!=null)
                                            return  decodeURI(r[2]);
                                        return  tip;
                                    }
                                </script>
                            </div>
        </div>
    </div>
    <div class="mc-b">
        <#include "../foot.html">
    </div>
    <#include "../jsPage.html">
        <script type="text/javascript">
            $("#chk_all").click(function(){
                $("input[name='trIds']").attr("checked",$(this).attr("checked"));
            });
            $("#batchdel").click(function(){
                var flag = false;

                $("input[name='trIds']:checked").each(function() {
                    if($(this).attr("checked")){
                        flag =true;
                        return false
                    }
                });

                if(flag){
                    $("#batchForm").submit();
                }else{
                    alert("请选择您要删除的记录!");
                }

            });
        </script>
    </body>
</html>